import http from '/@/utils/http';

/**
 * 公共api接口集合
 * @method getTaskInfoApi 维保任务/获取维保任务详情
 * @method getPlanInfoApi 维保计划/获取维保计划详情
 * @method batchBuildMaintainPlanApi 维保计划/批量生成任务
 * @method deleteMaintainPlanApi 维保计划/删除维保计划
 * @method deletePlanDeviceApi 维保计划/删除指定计划的设备
 * @method saveMaintainPlanApi 维保计划/新增维保计划
 * @method updateMaintainPlanApi 维保计划/修改维保计划
 * @method cancelMaintainTaskApi 维保任务/取消维保任务
 * @method deleteMaintainTaskApi 维保任务/删除维保任务
 * @method derivedMaintainPolicyApi 维保任务/维修单导出
 * @method saveDeviceItemApi 维保,点检项目/新增项目
 * @method updateDeviceItemApi 维保,点检项目/修改项目
 * @method delDeviceItemApi 维保,点检项目/删除项目
 * @method downloadMouldApi 导出模板
 * @method maintainTransmit 转交维保任务
 * @method getMaintainTaskUser 获取当前有维保任务的人员
 */

export const getWBTaskInfoApi = async (params: any) => {
    return await http.get(`/device/mobile/deviceMaintainTask/getInfo/${params}`)
}

export const cancelMaintainTaskApi = async (params: any) => {
    return await http.put(`/device/mobile/deviceMaintainTask/cancelMaintainTask`, params)
}

export const deleteMaintainTaskApi = async (id: any) => {
    return await http.delete(`/device/mobile/deviceMaintainTask/deleteMaintainTask/${id}`)
}

export const derivedMaintainPolicyApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceMaintainTask/derivedMaintainPolicy`, params)
}

export const saveDeviceItemApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceItem/save`, params)
}
export const updateDeviceItemApi = async (params: any) => {
    return await http.put(`/device/mobile/deviceItem/update`, params)
}

export const delDeviceItemApi = async (id: any) => {
    return await http.delete(`/device/mobile/deviceItem/delete/${id}`)
}

export const getPlanInfoApi = async (id: any) => {
    return await http.get(`/device/mobile/deviceMaintainPlan/getInfo/${id}`)
}

export const batchBuildMaintainPlanApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceMaintainPlan/batchBuildMaintainPlan`, params)
}

export const deleteMaintainPlanApi = async (id: any) => {
    return await http.delete(`/device/mobile/deviceMaintainPlan/deleteMaintainPlan/${id}`)
}

export const deletePlanDeviceApi = async (planId: any, deviceId: any) => {
    return await http.put(`/device/mobile/deviceMaintainPlan/deletePlanDevice/${planId}/${deviceId}`)
}

export const saveMaintainPlanApi = async (params: any) => {
    return await http.post(`/device/mobile/deviceMaintainPlan/saveMaintainPlan`, params)
}

export const updateMaintainPlanApi = async (params: any) => {
    return await http.put(`/device/mobile/deviceMaintainPlan/updateMaintainPlan`, params)
}

export const downloadMouldApi = async (itemType: any) => {
    return await http.postBlob(`/device/mobile/deviceItem/downloadMould/${itemType}`)
}

export const importItemExpertApi = async (itemType: any, file: any) => {
    return await http.postUpload(`/device/mobile/deviceItem/importItemExpert/${itemType}`, file)
}

export const maintainTransmit = async (params: any) => {
    return await http.post(`/device/mobile/deviceMaintainTask/maintainTransmit`, params)
}

export const getMaintainTaskUser = async () => {
    return await http.get(`/device/mobile/deviceMaintainTask/getMaintainTaskUser`)
}